package com.cheng.io.input;

import java.io.*;
import java.util.Date;
import java.util.List;

/**
 * 反序列化
 */
public class ObjectInputStreamTest02 {
    public static void main(String[] args) {
        try (
                ObjectInputStream objectInputStream = new ObjectInputStream(new FileInputStream("io/resources/dates"));
        ) {
            Object object = objectInputStream.readObject();
            if (object instanceof List<?>) {
                List<Date> dates = (List<Date>) object;
                for (Date date : dates) {
                    System.out.println(date);
                }
            }
        } catch (IOException | ClassNotFoundException e) {
            throw new RuntimeException(e);
        }
    }
}
